-
Notifications
You must be signed in to change notification settings - Fork 83
feat(NumberField): numeric input component #193
Conversation
Allows for HTML numeric validations, including min, max, step. Binds value as a number.
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/thecomputerm/svelte-materialify/BzY1rMCRAsHonRVK2FnT3ucfTodQ |
This component is meant to provide the kind of numeric binding that Svelte provides on And so, its styles are entirely shared with I'd appreciate feedback on the structure: Does it makes more sense to create new .scss files for this component? Should these be extracted to a higher level and shared? If we do that, should we rename "text-field" to something else where it occurs in styles? Thanks! |
This will generate duplicate styles, and is this a bug with svelte as we are setting the type to 'number' and it is still returning string? |
Not a bug with Svelte, per Rich Harris's answer on StackOverflow, the As a result, even when we set
Yes, I agree -- which is why I wonder about abstracting the styles to a higher level? Alternately, one sort of super-component could be set to observe the "type" property and swap out html |
I am thinking of coming up with a new format using svelte:fragments such as: <InputField>
<svelte:fragment slot="label">
Label Text
</svelte:fragment>
<input type='text' />
</Input Field> This would allow us to add textarea, numberic field and text field in one component and not too much extra css. |
When `multiple` prop is false, the value of a `<Select />` is a single value. Updated .d.ts to reflect this.
In that approach, would (I'd vote for the second option, especially since the accepted props on the different kinds of inputs are different. This would let us define those separately for each input type for the purposes of clear documentation, and also for typescript users.) I'm not familiar with the In any case, let me know how you want me to proceed with regards to this PR. If you want to create an |
The only problem with that would be forwarding props. I'll see what I can do to solve this, you can also post here if you have come up with a solution. |
A solution here would be great (and we need it as we are engaged in a project where several fields are numeric fields only). For now we are using |
Since it seems we agree this approach is not the right one, even if we're not decided on a solution, I'm closing and opening issue #224 as a place to discuss a possible solution. |
No description provided.